package zpin.dao;

import org.hibernate.Query;

import util.dao.HibernateDaoImpl;
import zpin.model.Authorization;
import zpin.model.Company;
import zpin.model.Person;

public class CompanyDaoImpl extends HibernateDaoImpl<Company, Long> implements CompanyDao{
	public Company findByFk(Authorization authorization) {
		Query query = this.getSession().createQuery("from "+Company.class.getName()+" p where p.authorization.id="+authorization.getId());
		if(query.uniqueResult()!=null){
			return (Company) query.list().get(0);
		}else{
			return null;
		}
	}
}
